package com.evil.Servlet;

import com.evil.Bean.AnswerOverItemBean;
import com.evil.Bean.OverAnswerBean;
import com.evil.DAO.AnswerOverItemDAO;
import com.evil.Data.Data;
import com.evil.Utils.PropertiesUtils;
import com.evil.Utils.Utils;
import com.google.gson.Gson;
import com.mysql.jdbc.Util;
import jdk.nashorn.internal.ir.debug.JSONWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

/********************************************
 * 工程名：Web
 * 包名：${PACKAGE_NAME}
 * 时间：16-9-14 下午5:19
 * 作者：白雨濃 evil
 * 邮箱：evilbai@foxmail.com
 * 内容：获得已经答完的列表Servlet,
 *        或者操作已经答完的列表
 ********************************************/
public class OverAnswerServlet extends BaseServlet
{
    private String phone;
    private String imei;


    @Override
    public void doPost()
    {
        phone = getParameter("phone");
        imei = getParameter("imei");

        getAllList();
    }

    private void getAllList()
    {
        AnswerOverItemDAO dao = new AnswerOverItemDAO();
        ArrayList<OverAnswerBean> list = dao.getAllList(phone);
        Map<String, String> userInfo = dao.getUserAnswerInfo(phone);

        print(new Gson().toJson(userInfo) + new PropertiesUtils().get("BREAKSTRING") + new Gson().toJson(list));
    }


}
